import { defineStore } from "pinia";
export const useCommonStore = defineStore('common', { // 公用的
    // state: ()=>({name: 'alice',count: 0}),
    state: () => {
        return {
            count: 10,
            isCollapse: false ,// 控制侧边menu是否折叠，默认不折叠
            user: {
                username: 'admin',
                gender: 0, // 0 女，1 男
                introduce: '我是admin', // 简介
                imageUrl: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png' // 用户头像
            }
        }
    },
    getters: {
        doubleCount: (state) => state.count * 2,
        // doublePlusOne:(state)=> state.doubleCount+1

    },
    actions: {
        increment() {
            this.count++
        },
        changeIsCollapse() {
            this.isCollapse = !this.isCollapse
        }

    }
})
